<template>

    <v-table :options="mytable" @cellDoubleClickedHandle ="cellDoubleClickedHandle" @refreshActionHandle="pageQuery" @deleteHandle = "deleteHandle" @saveHandle ="saveHandle"></v-table>

</template>

<script>
  import vTable from 'components/Table.vue'
  export default {
    components:{
        vTable
    },
    data:function (){

      return {
        mytable:{
          data:[
            {
              destination: '0.0.0.0',
              netmask: '0.0.0.0',
              gateway: '192.168.123.254',
              interface: '192.168.123.88',
              metric: '1'
            },
            {
              destination: '0.0.0.0',
              netmask: '0.0.0.0',
              gateway: '192.168.123.254',
              interface: '192.168.123.88',
              metric: '1'
            },
            {
              destination: '127.0.0.0',
              netmask: '255.0.0.0',
              gateway: '127.0.0.0',
              interface: '127.0.0.0',
              metric: '1'
            },
            {
              destination: '192.168.123.0',
              netmask: '255.255.255.0',
              gateway: '192.168.123.68',
              interface: '192.168.123.68',
              metric: '1'
            },
            {
              destination: '192.168.123.0',
              netmask: '255.255.255.0',
              gateway: '192.168.123.88',
              interface: '192.168.123.88',
              metric: '1'
            },
            {
              destination: '192.168.123.68',
              netmask: '255.255.255.255',
              gateway: '127.0.0.1',
              interface: '127.0.0.1',
              metric: '1'
            },
            {
              destination: '192.168.123.88',
              netmask: '255.255.255.255',
              gateway: '127.0.0.1',
              interface: '127.0.0.1',
              metric: '1'
            },
            {
              destination: '192.168.123.255',
              netmask: '255.255.255.255',
              gateway: '192.168.123.68',
              interface: '192.168.123.68',
              metric: '1'
            },
            {
              destination: '192.168.123.255',
              netmask: '255.255.255.255',
              gateway: '192.168.123.88',
              interface: '192.168.123.88',
              metric: '1'
            },
            {
              destination: '224.0.0.0',
              netmask: '224.0.0.0',
              gateway: '192.168.123.68',
              interface: '192.168.123.68',
              metric: '1'
            },
            {
              destination: '224.0.0.0',
              netmask: '224.0.0.0',
              gateway: '192.168.123.88',
              interface: '192.168.123.88',
              metric: '1'
            },
            {
              destination: '255.255.255.255',
              netmask: '255.255.255.255',
              gateway: '192.168.123.68',
              interface: '192.168.123.68',
              metric: '1'
            }
          ],
          columns:[
            //如果是多选 或者 有序号 添加这个
            // {
            //   type:"index",//index
            //   fixed:'left',
            // //   minWidth:'40'
            // },
            //所需要展示data 中的 数据 ，prop 绑定 data 中的属性值， label为表格中column 的header 值
            {
              prop:'destination',
              label:'Destination',
            //   minWidth:'100'
            },
            {
              prop:'netmask',
              label:'Netmask',
            //   minWidth:'100'
            },
            {
              prop:'interface',
              label:'Interface',
            //   minWidth:'100'
            },
            {
              prop:'gateway',
              label:'Gateway',
            //   minWidth:'200'
            },
            {
              prop:'metric',
              label:'Metric',
            //   minWidth:'200'
            }
         ],
          hasPagination :true,
          pageSize:4,
          pageIndex:2,
          total:20
        }
      };
    },
    methods:{
      cellDoubleClickedHandle(row,ev){
        // console.log("########父组件接收到子组件的信息");
        // console.log(row,ev);
      },

      saveHandle(index,row){
        // console.log("######saveHandle收到子组件信息");
        // console.log(index,row);
      },
      deleteHandle(index,row){
        // console.log("######deleteHandle收到子组件信息");
        // console.log(index,row);
      },
      //如果有分页
      pageQuery(pageIndex,pageSize){
        // console.log("###########pageQuery收到子组件信息");
        // console.log(pageIndex,pageSize);
      }
    },
    mounted:function (){

    }
  }
</script>